package com.dahong.cloud.authorize.config;

import com.lambda.cloud.redis.delay.RedisDelayConfig;
import com.lambda.cloud.redis.delay.RedisDelayedQueueManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedisDelayedQueueConfig {

    @Bean
    public RedisDelayConfig redisDelayConfig() {
        RedisDelayConfig redisDelayConfig = new RedisDelayConfig();
        redisDelayConfig.setName("testDelayedQueue");
        redisDelayConfig.setDelay(25);
        return redisDelayConfig;
    }

    @Bean
    public RedisDelayedQueueManager<String> redisDelayedQueueManager(RedisDelayConfig redisDelayConfig) {
        return new RedisDelayedQueueManager<>(redisDelayConfig, System.out::println);
    }
}
